subroutine get_xsec(e,a,ih,r)
  use param
  use global
  use gi10
  implicit none
  real(dbl),intent(in) :: e,a,ih
  real(dbl),intent(out) :: r
  real(dbl) :: dh,h1,h2,te,f,ip,ir
  integer :: i
  logical :: foo
  dh=ih
  h1=a
  te=e-a
  foo=.true.
  r=0
  do while(foo)
     h2=h1+dh
     if (h2.ge.te) then
        h2=te
        dh=te-h1
        foo=.false.
     end if
     f=0
     do i=1,ngi
        ip=0.5*(dh*qp(i)+h1+h2)
        call kernel(e,ip,ir)
        f=f+ir*qw(i)
     end do
     f=0.5*dh*f
     r=r+f
     h1=h2
  end do
  return
end subroutine get_xsec
